package cn.huapu.power.energy.service.impl;

import cn.huapu.power.energy.bean.PeaHistoryex20191M15;
import cn.huapu.power.energy.bean.bo.DateParameterBo;
import cn.huapu.power.energy.bean.vo.PeaHistoryex20191M15Vo;
import cn.huapu.power.energy.mapper.PeaHistoryex20191M15Mapper;
import cn.huapu.power.energy.service.PeaHistoryex20191M15Service;
import cn.huapu.power.energy.util.ObjectHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 测试用户权限服务实现类
 *
 * @author autogen
 */
@Service
public class PeaHistoryex20191M15ServiceImpl extends BaseServiceImpl<PeaHistoryex20191M15Mapper, PeaHistoryex20191M15, Integer> implements PeaHistoryex20191M15Service {
    @Autowired
    private PeaHistoryex20191M15Mapper pea15Mapper;


    @Override
    @Transactional(readOnly = true)
    public HashMap<String, Double> getSzDatas(DateParameterBo da) {
        HashMap<String, Double> pea = pea15Mapper.getSzDatas(da);
        return pea;
    }

    @Override
    @Transactional(readOnly = true)
    public HashMap<String, Double> getPzDatas(DateParameterBo da) {
        HashMap<String, Double> peaP = pea15Mapper.getPzDatas(da);
        return peaP;
    }

    @Override
    @Transactional(readOnly = true)
    public List<PeaHistoryex20191M15Vo> getFeesSave(DateParameterBo da) {
        List<PeaHistoryex20191M15Vo> list = pea15Mapper.getFeesSave(da);
        return list;
    }

    @Override
    @Transactional(readOnly = true)
    public List<PeaHistoryex20191M15> realZhgvPower(DateParameterBo da) {
        List<PeaHistoryex20191M15> list = new ArrayList<>();
        //电量节约
        da.setType1("SanLossEnergy");
        PeaHistoryex20191M15 m15;
        if (pea15Mapper.realZhgvPower(da).size() > 0) {
            m15 = pea15Mapper.realZhgvPower(da).get(0);
            if (ObjectHelper.isNotEmpty(m15)) {
                list.add(m15);
            }
        }
        //电费节约
        da.setType1("SanLossFee");
        if (pea15Mapper.realZhgvPower(da).size() > 0) {
            m15 = pea15Mapper.realZhgvPower(da).get(0);
            if (ObjectHelper.isNotEmpty(m15)) {
                list.add(m15);
            }
        }

        //原相间不平衡损耗系数
        da.setType1("原相间不平衡损耗系数");
        if (pea15Mapper.realZhgvPower(da).size() > 0) {
            m15 = pea15Mapper.realZhgvPower(da).get(0);
            if (ObjectHelper.isNotEmpty(m15)) {
                list.add(m15);
            }
        }

        //新相间不平衡损耗系数
        da.setType1("新相间不平衡损耗系数");
        if (pea15Mapper.realZhgvPower(da).size() > 0) {
            m15 = pea15Mapper.realZhgvPower(da).get(0);
            if (ObjectHelper.isNotEmpty(m15)) {
                list.add(m15);
            }
        }

        return list;
    }

    @Override
    @Transactional(readOnly = true)
    public List<PeaHistoryex20191M15Vo> realLossFee(DateParameterBo da) {
        List<PeaHistoryex20191M15Vo> list = pea15Mapper.realLossFee(da);
        return list;
    }

}
